package com.ruoyi.pv.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pv.mapper.PvTrainingProgramMapper;
import com.ruoyi.pv.domain.PvTrainingProgram;
import com.ruoyi.pv.service.IPvTrainingProgramService;

/**
 * 实训项目Service业务层处理
 *
 * @author zzx
 * @date 2023-03-12
 */
@Service
public class PvTrainingProgramServiceImpl implements IPvTrainingProgramService {
    @Autowired
    private PvTrainingProgramMapper pvTrainingProgramMapper;

    /**
     * 查询实训项目
     *
     * @param id 实训项目主键
     * @return 实训项目
     */
    @Override
    public PvTrainingProgram selectPvTrainingProgramById(Long id) {
        return pvTrainingProgramMapper.selectPvTrainingProgramById(id);
    }

    /**
     * 查询实训项目列表
     *
     * @param pvTrainingProgram 实训项目
     * @return 实训项目
     */
    @Override
    public List<PvTrainingProgram> selectPvTrainingProgramList(PvTrainingProgram pvTrainingProgram) {
        return pvTrainingProgramMapper.selectPvTrainingProgramList(pvTrainingProgram);
    }

    /**
     * 新增实训项目
     *
     * @param pvTrainingProgram 实训项目
     * @return 结果
     */
    @Override
    public int insertPvTrainingProgram(PvTrainingProgram pvTrainingProgram) {
        pvTrainingProgram.setCreateTime(DateUtils.getNowDate());
        return pvTrainingProgramMapper.insertPvTrainingProgram(pvTrainingProgram);
    }

    /**
     * 修改实训项目
     *
     * @param pvTrainingProgram 实训项目
     * @return 结果
     */
    @Override
    public int updatePvTrainingProgram(PvTrainingProgram pvTrainingProgram) {
        return pvTrainingProgramMapper.updatePvTrainingProgram(pvTrainingProgram);
    }

    /**
     * 批量删除实训项目
     *
     * @param ids 需要删除的实训项目主键
     * @return 结果
     */
    @Override
    public int deletePvTrainingProgramByIds(Long[] ids) {
        return pvTrainingProgramMapper.deletePvTrainingProgramByIds(ids);
    }

    /**
     * 删除实训项目信息
     *
     * @param id 实训项目主键
     * @return 结果
     */
    @Override
    public int deletePvTrainingProgramById(Long id) {
        return pvTrainingProgramMapper.deletePvTrainingProgramById(id);
    }

    @Override
    public int insertPvTrainingProgramAll(List<PvTrainingProgram> programs) {
        return pvTrainingProgramMapper.insertPvTrainingProgramAll(programs);
    }
}
